//
//  NewsModel.m
//  MicroNews
//
//  Created by tongcheng on 15/10/26.
//  Copyright © 2015年 siyue. All rights reserved.
//

#import "NewsModel.h"

@implementation NewsModel

-(instancetype)initWithDict:(NSDictionary *)dict
{
    self = [super init];
    if(self){
        self.iid = dict[@"id"];//
        self.c_id = dict[@"c_id"]; //分类ID
        self.title = dict[@"title"];//
        self.thumb = dict[@"thumb"];//
        self.addtime = dict[@"addtime"];//
        self.source = dict[@"source"]; //来源
        self.commont = dict[@"commont"]; //评论
        self.timedesc = dict[@"timedesc"]; //1个月前
        
    }
    
    return self;
}

+(instancetype)newsWithDict:(NSDictionary *)dict
{
    return [[self alloc] initWithDict:dict];
}


+(NSMutableArray *)didNews:(NSMutableArray *)json
{
    NSMutableArray *arrayM = [NSMutableArray array];
    
    if (![json isKindOfClass:[NSNull class]]) {
        for (NSDictionary *dict in json) {
            
            [arrayM addObject:[NewsModel newsWithDict:dict]];
        }
        
        return arrayM;
    }
    return nil;
}


@end
